#pragma once
#include <sys/epoll.h>

namespace wb
{
enum class poll_ops : uint64_t
{
    r = EPOLLIN,
    w = EPOLLOUT,
    rw = EPOLLIN | EPOLLOUT,
};

inline auto operator|(poll_ops o, uint64_t i)
{
    return static_cast<uint64_t>(o) | i;
}

inline auto operator&(poll_ops o, uint64_t i)
{
    return static_cast<uint64_t>(o) & i;
}

inline void operator|=(poll_ops& o, uint64_t i)
{
    o = static_cast<poll_ops>(o | i);
}

inline void operator&=(poll_ops& o, uint64_t i)
{
    o = static_cast<poll_ops>(o & i);
}

enum class poll_status
{
    event,    // successfully polled events
    timeout,  // poll timeout
    error,    // fd error
    closed    // fd closed by remote or internal error
};

}  // namespace wb